package com.zhongnan.demo2;

public class MyFactoria {
    public static void main(String[] args) {
        int num = 1;
        int count = 0;
        for (int i = 1; i <= 100; i++) {
            count += i;
        }
        System.out.println(count);
        // 递归
        int num1 = factorial(100);
        System.out.println(num1);
    }

    private static int factorial(int num) {
        if (num == 1) {
            return 1;
        } else {
            return num + factorial(num - 1);
        }
    }

}
